#include "SoundHelpers.h"

void Helper::LoadWAVFile(const char *_file, PTRWAVDATA _dataHolder)
{
	std::fstream file = std::fstream(_file, std::fstream::in | std::fstream::binary);

	file.seekg(22, std::fstream::beg);
	file.read((char*) &_dataHolder->Channels, 2);

	file.seekg(24, std::fstream::beg);
	file.read((char*) &_dataHolder->SampleRate, 4);

	file.seekg(34, std::fstream::beg);
	file.read((char*) &_dataHolder->BitsPerSample, 2);

	file.seekg(40, std::fstream::beg);
	file.read((char*) &_dataHolder->DataSize, 4);

	_dataHolder->Data = new char[_dataHolder->DataSize];

	file.seekg(44, std::fstream::beg);
	file.read(_dataHolder->Data, _dataHolder->DataSize);
}